var mongoose = require('mongoose')
var Schema = mongoose.Schema

// 连接数据库
mongoose.connect('mongodb://localhost/test', {useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: false })

var topicSchema = new Schema({
    type: {
        type: String    
    },
    title: {
        type: String,
        default: ''
    },
    userId: {
        type: String
    },
    article: {
        type: String,
        default: ''
    }
})

module.exports = mongoose.model('Topic', topicSchema)